﻿{#template MAIN}
<table id="gridPaymentHistory" cellpadding="5" cellspacing="1" class="grid">
    <thead class="sub">
        <tr>
            <th style="display: none">
                PaymentBatchID
            </th>
            <th style="width: 100px">
                Date
            </th>
            <th>
                Amount
            </th>
            <th>
                Fee
            </th>
            <th>
                Deposit
            </th>
            <th>
            </th>
            <th width="48px">
                <a class="btnNew">Payment</a>
            </th>
        </tr>
    </thead>
    <tbody>
        {#foreach $T.List as payment}
        <tr class="{#cycle values=['','evenRow']} special">
            {#include ROW root=$T.payment}
            <td>
                <a serviceid='{$T.payment.PaymentBatchID}' class="btnEdit new">Edit</a>&nbsp;|&nbsp<a paymentid="{$T.payment.PaymentBatchID}"
                    class="btnDelete new">Remove</a>
            </td>
        </tr>
        {#/foreach}
    </tbody>
    <tfoot>
        <tr>
            <th colspan="8">
            </th>
        </tr>
    </tfoot>
</table>
{#/template MAIN} {#template ROW}
<td style="display: none">
    {$T.PaymentBatchID}
</td>
<td>
    {formatJSONDate($T.PaymentDate)}
</td>
<td style="text-align: right">
    {formatCurrency($T.PaidAmount)}
</td>
<td style="text-align: right">
    {formatCurrency($T.PaidFee)}
</td>
<td>
    {#if $T.DepositFlag}Yes{#/if}
</td>
<td>
    <table width="100%">
        <thead>
            <th>
                Method
            </th>
            <th colspan="2">
                Price
            </th>
            <th colspan="2">
                Fee
            </th>
            <th>
                Received
            </th>
        </thead>
        <tbody>
            {#foreach $T.PaymentBatchDetailCollection as batchdetail} {#if $T.batchdetail.Active}
            <tr>
                <td>
                    {$T.batchdetail.MethodN}
                </td>
                <td style="text-align: right">
                    {formatCurrency($T.batchdetail.Amount)}
                </td>
                <td>
                    {$T.batchdetail.UnitPriceN}
                </td>
                <td style="text-align: right">
                    {$T.batchdetail.Fee}
                </td>
                <td>
                    {$T.batchdetail.UnitFeeN}
                </td>
                <td style="display: none">
                    {$T.batchdetail.Rate}
                </td>
                <td style="display: none">
                    {$T.batchdetail.FeeRate}
                </td>
                <td>
                    {$T.batchdetail.ReceivedBy}
                </td>
                <td style="display: none">
                    {$T.batchdetail.PaymentMethod}
                </td>
                <td style="display: none">
                    {$T.batchdetail.CardType}
                </td>
                <td style="display: none">
                    {$T.batchdetail.CurrencyAmount}
                </td>
                <td style="display: none">
                    {$T.batchdetail.CurrencyFee}
                </td>
            </tr>
            {#/if} {#/foreach}
        </tbody>
    </table>
</td>
{#/template ROW}